<template>
    <div class="components-head">
        <van-nav-bar
	    left-text="返回"
	    left-arrow
		@click-left="onClickLeft">
			<template #title>
				<img class="title-logo" @click="goHome" src="../../assets/project-logo.png" alt="">
			</template>
			<template #right>
				<div @click="toUser" class="nav-img"><img src="../../assets/user.png" ></div>
			</template>
	    </van-nav-bar>
    </div>
</template>
<script>
import{mapActions,mapState} from "vuex"
export default {
    data(){
        return{

        }
    },
    methods:{
		...mapActions(["saveRouter"]),
        // 回到首页
        goHome(){
            this.$router.push({path:"/home"})
        },
        // 返回上一页面
        onClickLeft(){
			// 有上一级页面
            if(this.turnOpen==0){
                this.$router.go(-1);
            }else{
				// 没有上一级页面返回首页
                this.$router.push({path:'/home'})
                this.saveRouter(0)
            }
        },
		// 去用户信息
		toUser(){
			this.$router.push({path:"/user"})
		}
    }
}
</script>
<style lang="less" scoped>
// 顶部样式
/deep/.van-nav-bar__text{
	color: #333;
}
/deep/.van-nav-bar{
	.van-icon{
		color: #333;
	}
}
.nav-img{
	img{
		width: 0.39rem;
		height: 0.39rem;
	}
}
.title-logo{
	width: 1.92rem;
	height: 0.46rem;
}
</style>